<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Company extends User_Controller
{
private $response = array();
	private $userModel;
	private $clientModel;
	private $requestManager;
	private $settings;
    public function __construct()
    {
        parent::__construct();
        
    	if(isset($this->session) && !$this->session->userdata('isLogged')) {
        	redirect('/');
        }
        
        $this->userModel = $this->load->model('User_Model');
        $this->clientModel = $this->load->model('Client_Model');
        $this->load->helper('RequestManager');
        $this->requestManager = RequestManager::getInstance();
        $this->settings = $this->config->item('settings');
        $this->load->helper(array('ConstantsUtils','StringUtils','DateUtils'));
    
        
    }

    public function index(){
    	$data = array();
    	//$this->requestManager->setData(array('user_id'=>$user_id));
		$this->requestManager->setSendType("rest");
		$this->requestManager->setAccessPath($this->settings['api_path']."payroll/client_payroll_periods/" .$this->settings['client_key']);
		$return = $this->requestManager->send();
		if($return->message == 'success'){
			$data['periods'] = $return->data;
			//var_dump($data['payroll_periods']);
		}
		
		$this->requestManager->setSendType("rest");
		$this->requestManager->setAccessPath($this->settings['api_path']."client/get_holidays/" .$this->settings['client_key']);
		$return = $this->requestManager->send();
		
    	if($return->message == 'success'){
			$data['holidays'] = $return->data;
			//var_dump($data['payroll_periods']);
		}
		
    	$this->load->view('header');
		$this->load->view('index',$data);
		$this->load->view('footer');
    }
    
	
}